<?

require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.photos.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.hotels.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.airports.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.exchange_rates.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.hotel_special_offers.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.tree.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.reviews.php";



	$template = new template();
	$template->section_highlight = "hotels";
	$template->left_col = true;
	$template->search_tab = "hotels";
	$template->ld_head();
	
	$lurls = new lurls();
	$hotel_special_offers = new hotel_special_offers();
	$destinations = new destinations();
	$hotels = new hotels();
	$airports = new airports();
	$photos = new photos();
	$tree = new tree();

?>





<div class="box_title_h2">
<div class="box_title_h2_wm box_title_h2_wm_4">

	<h2>Hotel Deals</h2>
	<p>Cheap hotels in all the top Mediterranean holiday destinations</p>
    
</div>
</div>






<!-- Start left column -->


<div class="col_290 margin_right_20">









	
	
	
<?

	
$specials = new hotel_special_offers();
$params['order'] = "random";
$params['limit'] = "5";
$current_specials = $specials->get_specials($params);
unset($params);
if(!empty($current_specials)){
	

?>



<!-- Start special offers -->



<div class="box_title_h3_bg">
<div class="box_title_h3_left">
<div class="box_title_h3_wm box_title_h3_wm_1">
<h3 class="box_title_h3" title="Hotel Deals">Hotel Deals</h3>
</div>
</div>
</div>




<?


foreach($current_specials as $special_values){


	// Get hotel 
	$params['tree_id'] = $special_values['hotel_tree_id'];
	$lookup = $hotels->lookup_hotel($params);
	unset($params);
	
	// Set values
	$hotel_values = $lookup['hotel_values'];
	$resort_values = $lookup['resort_values'];
	$destination_values = $lookup['destination_values'];
	

	// get photo url
	$lead_hotel_thumb_url = $tree->photo_url($hotel_values['main_photo']);
	
	
	// Get the display price
	$display_price = $special_values['price_per_night']; 

	
	// Get LURL
	$offer_lurl = $lurls->get_branch_lurl($hotel_values['tree_id']);

	
	// Link title
	$link_title = "Cheap hotels in ".$resort_values['name'].", ".$destination_values['name'];
	
	
?>



<!-- Start offer instance -->
<div class="lowlight offer_body_div" onclick="location='<?= $offer_lurl ?>'" onmouseover="this.className='highlight offer_body_div';" onmouseout="this.className='lowlight offer_body_div';">


<div class="col_80 margin_right_10">
    <div class='thumb_cover_div'>
    <img src='<?= $lead_hotel_thumb_url ?>' alt='<?= $hotel_values['name'] ?>' class="thumb_image_80" />
    <img src="/images/thumb_cover_80_59.gif" class="thumb_cover" alt='<?= $hotel_values['name'] ?>'  />
    </div>
</div>



<div class="col_190">

<p class="title_big"><a href="<?= $offer_lurl ?>" title="Book <?= $hotel_values['name'] ?> online"><?= $hotel_values['name'] ?></a></p>
<p class="title_med"><a href="<?= $offer_lurl ?>" title="Cheap hotels in <?= $resort_values['name'].", ".$destination_values['name'] ?>"><?= $resort_values['name'].", ".$destination_values['name'] ?></a></p>
<p class="no_margin"><?= output_rating($hotel_values['hotel_rating'], "star", true); ?> from <a class="price_med" href="<?= $offer_lurl ?>" title="<?= $hotel_values['name']." offer"; ?>">&euro;<?= $display_price ?></a> per room per night</p>


</div>


<div class="clearing"></div>



</div>
<!-- End offer instance -->


<? } ?>


<div style="margin-bottom: 10px"></div>
<!-- End special offers -->


<? } ?>


















<?
	// Display a random destination
	$random_destination = $destinations->get_random_destination();
	$random_destination = $random_destination[0];
	// Get LURL
	$destination_lurl = $lurls->get_branch_lurl($random_destination['tree_id']);
	unset($params);
	
	include SITE_ROOT_PATH."/_lib/html/highlight_destination.php";

?>


	
	
	


	

</div>
<!-- End left column -->



















<!-- Start right column -->

<div class="col_300">





<? 

$handle = fopen(FILE_TOP_SEARCHES, "r");
$top_destinations_file_contents = fread($handle, filesize(FILE_TOP_SEARCHES));
fclose($handle);

$top_destinations = explode(',', $top_destinations_file_contents);

if(!empty($top_destinations)){
?>


<!-- Start top destinaitons -->

<div class="box_lb_brd_300">
<div class="box_lb_brd_300_cap">
<div class="box_lb_brd_300_shoe">
<div class="box_lb_brd_bg_hat">

<div class="box_padding">

<h4 title="Top Holiday Destinations">Top Holiday Destinations</h4>
<p>Top holiday destinations this week:</p>
<ul>
<?
$destinations_id_array = array();
$i=0;
foreach($top_destinations as $destination_airport_code){


	$params['airport_code'] = $destination_airport_code;
	$params['type_id'] = '1';
	$params['position'] = 'bottom';
	$destination_values = $destinations->destination_lookup($params);
	$destination_values = $destination_values[0];
	unset($params);
	
	$destination_lurl = $lurls->get_branch_lurl($destination_values['tree_id']);

	
	if($destination_values AND (!in_array($destination_values['tree_id'], $destinations_id_array))){

		echo "<li title='".$destination_values['name']." holidays'><a href='".$destination_lurl."' title='".$destination_values['name']."'>".$destination_values['name']."</a></li>";
		
		$i++;
		
	}

	$destinations_id_array[] = $destination_values['tree_id'];
	
	if($i>9) break;
	
} 

?>
</ul>

</div>

</div>
</div>
</div>
</div>


<br />


<!-- End top destinations -->
<? } ?>










<?

	$reviews = new reviews();
	$params['limit'] = '2';
	$params['status'] = 'a';
	$latest_reviews = $reviews->get_reviews($params);

?>



<!-- Start latest customer reviews -->


<div class="box_title_h3_bg">
<div class="box_title_h3_left">
<div class="box_title_h3_wm box_title_h3_wm_4">
<h3 class="box_title_h3" title="Latest Hotel Reviews">Latest Hotel Reviews</h3>
</div>
</div>
</div>


<p class="no_margin">Get the inside scope on our hotels directly from the customer.</p>


<?

foreach($latest_reviews as $review_values){

	// Get hotel 
	$params['tree_id'] = $review_values['tree_id'];
	$hotel_values = $tree->get_branch($params);
	$hotel_values = $hotel_values[0];
	unset($params);
	
	// Get LURL
	$review_lurl = $lurls->get_hotel_review_lurl($hotel_values['tree_id']);

?>


<!-- Start customer review -->

<div class="box_lb_rev_300_cap">

<p style="margin:0; padding: 20px 10px 2px 10px"><strong><?= $review_values['reviewer_name'] ?></strong> gave a the <strong><?= $hotel_values['name'] ?></strong> rating of <?= output_rating($review_values['overall'], "rate", true); ?> and said...</p>

</div>

<div class="box_lb_rev_300">
<div class="box_lb_rev_300_cap2">
<div class="box_lb_rev_300_shoe">

<div class="box_padding">

<p class="title_med" title="<?= $hotel_values['name']." ".$review_values['review_title'] ?>"><?= $review_values['review_title'] ?></p>

<p class="no_margin"><?= trim_me($review_values['review'],'90') ?> <a href="<?= $review_lurl ?>">more</a></p>

</div>

</div>
</div>
</div>

<!-- End customer reviews -->


<? } ?>


















</div>

<!-- End right column -->






<?

	$template->ld_foot();
	
?>